package com.learn.annotation;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author chenxin
 * @time 2016-12-29-17:30
 */
@Component
@Aspect @Order(Ordered.HIGHEST_PRECEDENCE) public class FooAdvice {
    @Pointcut("@annotation(com.learn.annotation.Foo)") public void point() {
    }

    @Around("point()") public void around(ProceedingJoinPoint pjp) throws Throwable {
        Object result = pjp.proceed();
        try {
            System.out.println("执行注解FooAdvice");
        }  catch (Exception e) {
            e.printStackTrace();
        }
        throw new RuntimeException();
    }
}
